Use case: encryption/decryption in interrupt mode ¶
Sequence diagram ¶
Code snippet ¶
|
HAL1 |
HAL2 |
|---|---|
/* Encryption */
HAL_CRYP_Encrypt_IT(&hcryp, Plaintext, PLAINTEXT_SIZE,
EncryptedText);
/* Only for GCM algorithm */
HAL_CRYPEx_AESGCM_GenerateAuthTAG(&hcryp,TAG,
TIMEOUT_VALUE);
/* Only for CCM algorithm */
HAL_CRYPEx_AESCCM_GenerateAuthTAG(&hcryp,TAG,
TIMEOUT_VALUE);
/* Decryption */
HAL_CRYP_Decrypt_IT(&hcryp,Ciphertext , PLAINTEXT_SIZE,
DecryptedText);
/* Only for GCM algorithm */
HAL_CRYPEx_AESGCM_GenerateAuthTAG(&hcryp,TAG,
TIMEOUT_VALUE);
/* Only for CCM algorithm */
HAL_CRYPEx_AESCCM_GenerateAuthTAG(&hcryp,TAG,
TIMEOUT_VALUE);
|
/* Encryption */
HAL_CRYP_Encrypt_IT(&hcryp, Plaintext, PLAINTEXT_SIZE,
EncryptedText);
/* Only for GCM algorithm */
HAL_CRYP_GCM_GenerateAuthTAG(&hcryp,TAG,
TIMEOUT_VALUE);
/* Only for CCM algorithm */
HAL_CRYP_CCM_GenerateAuthTAG(&hcryp,TAG,
TIMEOUT_VALUE);
/* Decryption */
HAL_CRYP_Decrypt_IT(&hcryp, Ciphertext, PLAINTEXT_SIZE,
DecryptedText);
/* Only for GCM algorithm */
HAL_CRYP_GCM_GenerateAuthTAG(&hcryp,TAG,
TIMEOUT_VALUE);
/* Only for CCM algorithm */
HAL_CRYP_CCM_GenerateAuthTAG(&hcryp,TAG,
TIMEOUT_VALUE);
|
Key changes ¶
Interrupt-mode encryption and decryption APIs keep the same names (
HAL_CRYP_Encrypt_IT()/HAL_CRYP_Decrypt_IT()).Tag generation APIs are renamed from
HAL_CRYPEx_AES*toHAL_CRYP_*for GCM and CCM algorithms.

